<template>
  <el-dialog v-model="dialogVisible" class="!border-rd-10px" title="客服配置" width="500">
    <el-form
      ref="ruleFormRef"
      :model="ruleForm"
      label-width="auto"
      class="demo-ruleForm"
      :size="formSize"
      status-icon
    >
      <el-form-item label="客服名称">
        <el-select
          v-model="ruleForm.name"
          filterable
          multiple
          collapse-tags
          collapse-tags-tooltip
          placeholder="请选择客服名称"
        >
          <el-option label="222" value="1" />
          <el-option label="444" value="2" />
          <el-option label="2212" value="3" />
          <el-option label="113" value="4" />
        </el-select>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="text-center">
        <el-button type="primary" @click="submitForm(ruleFormRef)">提交</el-button>
      </div>
    </template>
  </el-dialog>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue'
import type { ComponentSize, FormInstance, FormRules } from 'element-plus'

interface RuleForm {
  name: number
}

const formSize = ref<ComponentSize>('default')
const ruleFormRef = ref<FormInstance>()
const ruleForm = reactive<RuleForm>({
  name: ''
})


const submitForm = async (formEl: FormInstance | undefined) => {
  if (!formEl) return
  await formEl.validate((valid, fields) => {
    if (valid) {
      // console.log('submit!')
    } else {
      // console.log('error submit!', fields)
    }
  })
}

const dialogVisible = ref(false)
function show(val) {
  dialogVisible.value = val
}
defineExpose({ show, dialogVisible })
</script>
<style scoped lang="scss"></style>
